﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模拟用户点击</title>
</head>
<body>

<h3>请单击”Click Me"。测试提交按钮与超链接是否也被单击了。</h3> 
    <button id="btn">Click Me</button> 
    <form action="#"> 
        <input type="text" name="userName" value="徐新华-polaris" readonly/> 
        <input id="submit" type="submit" value="别点击此按钮提交" onclick="alert('触发了提交按钮的单击事件！');"/> 
    </form> 
    <a id="aLink" href="http://www.google.cn" onclick = "alert('触发了超链接的单击事件！');">代码触发超链接</a> 

<script>
 
 $(function() 
{ 
    $("#btn").click(function() 
    { 
        $("#submit").click(); 
        $("#aLink").click(); 
    }); 
}); 

</script>

</body>
</html>